/**
 * 
 */
package life.exam03;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @author jaty
 *
 */
public class LifeBeanImpl implements LifeBean, InitializingBean, DisposableBean {

	private String lifeVar1;
	private long  lifeVar2;
	
	@Override
	public void getMessage() {
		System.out.println("getMessage() print...");
	}
	
	// InitializizingBean interface method <= Init method provided by spring
	// this is executed after empty bean object is created by spring container, and objects depending on properties were injected to it.
	// Thus, this can be used to verify the values were correctly injected to properties.
	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("afterPropertiesSet() Execution... lifeVar1= " + lifeVar1 + " lifeVar2= " + lifeVar2);
	}
	
	//DisposableBean Interface method <= Destruction method provided by spring
	// Can be used to release resources before the empty object is destroyed.
	@Override
	public void destroy() throws Exception {
		System.out.println("destroy() execution...");
	}
	
	public void setLifeVar1(String lifeVar1) {
		this.lifeVar1 = lifeVar1;
	}
	
	public void setLifeVar2(long lifeVar2) {
		this.lifeVar2 = lifeVar2;
	}
	
}
